package com.exercise.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import com.exercise.dao.QuestionDao;
import com.exercise.model.Question;

@Repository("questionDao")
public class QuestionDaoImpl implements QuestionDao{

	@Resource
	private SessionFactory sessionFactory;
	
	@Override
	public int saveQuestion(Question question) {
		
		
		Session session=sessionFactory.getCurrentSession();
		Integer result=(Integer)session.save(question);
		
		if (result > 0) {
			return 1;
		}else{
			return 0;
		}
		
	}

	@Override
	public int deleteQuestion(Question question) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Question selectQuestion(Question question) {
		// TODO Auto-generated method stub
		return null;
	}

	
	
}
